﻿using System;
using System.Linq;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Quadrant.domain.DB;

namespace Quadrant.web.Controllers
{
    [Authorize]
    public class QuadrantController : Controller
    {
        [HttpGet]
        public ActionResult Index()
        {
            using (var db = new QuadrantContext())
            {
                var usr = new Guid(this.User.Identity.GetUserId());
                var quadrant = db.Quadrants.FirstOrDefault(p => p.OwnerId == usr);
                Guid? quadrantId = null;
                if (quadrant != null)
                {
                    quadrantId = quadrant.Id;
                }
                ViewBag.Qid = quadrantId;
                return View();
            }

        }
    }
}